package com.dmall.opening.up.records;

import com.dmall.opening.up.records.service.ThirdPartyOrderService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

import static com.dmall.opening.up.records.util.Beans.getString;

public class ThirdPartyOrderRecord extends OrderRecord {

    @Autowired
    private Map<String, ThirdPartyOrderService> services;

    @Override
    public void cancel() {
        getThirdPartyOrderService().cancel(id);
    }

    private ThirdPartyOrderService getThirdPartyOrderService() {
        return services.get(getString(ext, "third_party_mode", "http") + ".third.party.order.service");
    }
}
